{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "vscode": {
     "languageId": "plaintext"
    }
   },
   "source": [
    "<!-- Banner Image -->\n",
    "<img src=\"https://uohmivykqgnnbiouffke.supabase.co/storage/v1/object/public/landingpage/brevdevnotebooks.png\" width=\"100%\">\n",
    "\n",
    "<!-- Links -->\n",
    "<center>\n",
    "  <a href=\"https://brev.nvidia.com\" style=\"color: #06b6d4;\">Console</a> •\n",
    "  <a href=\"https://developer.nvidia.com/brev\" style=\"color: #06b6d4;\">Docs</a> •\n",
    "  <a href=\"/\" style=\"color: #06b6d4;\">Templates</a> •\n",
    "  <a href=\"https://discord.gg/NVDyv7TUgJ\" style=\"color: #06b6d4;\">Discord</a>\n",
    "</center>\n",
    "\n",
    "# Setup MicroK8s + NIM Operator on Brev! 🤙\n",
    "\n",
    "Welcome!\n",
    "\n",
    "In this notebook, we will run some simple commands to show how you can install MicroK8s and NIM operator in your Jupyter Notebook environment. \n",
    "\n",
    "\n",
    "**Important Note**: In order to download a NVIDIA NIM, you will need to grab a key from NGC.\n",
    "\n",
    "### Help us make this tutorial better! Please provide feedback on the [Discord channel](https://discord.gg/y9428NwTh3) or on [X](https://x.com/brevdev)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Introduction\n",
    "\n",
    "MicroK8s is a lightweight, production-ready Kubernetes distribution that allows for easy deployment of a fully-functional Kubernetes cluster on a single machine or across multiple nodes. It provides a streamlined installation process and includes essential Kubernetes components and add-ons, making it ideal for developers working in small-scale production environments.\n",
    "\n",
    "The NVIDIA NIM Operator is a Kubernetes operator designed to simplify the deployment, management, and scaling of NVIDIA NIM microservices on Kubernetes clusters. It automates the lifecycle management of AI inference pipelines, supports model pre-caching to reduce initial inference latency, and enables autoscaling of NIM services using Kubernetes Horizontal Pod Autoscaler (HPA).\n",
    "\n",
    "References:\n",
    "- https://docs.nvidia.com/nim-operator/latest/index.html\n",
    "- https://docs.nvidia.com/nim/large-language-models/latest/introduction.html\n",
    "- https://developer.nvidia.com/nim\n",
    "- https://developer.nvidia.com/blog/managing-ai-inference-pipelines-on-kubernetes-with-nvidia-nim-operator/\n",
    "- https://k8s.co.il/nvidia/nvidia-nim-operator-in-10-minutes/"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "vscode": {
     "languageId": "plaintext"
    }
   },
   "outputs": [],
   "source": [
    "%%bash\n",
    "\n",
    "export NGC_API_KEY=<enter-key-here>\n",
    "\n",
    "wget https://raw.githubusercontent.com/brevdev/notebooks/refs/heads/main/assets/setup-k8s.sh\n",
    "wget https://raw.githubusercontent.com/brevdev/notebooks/refs/heads/main/assets/setup-nim-operator.sh"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "vscode": {
     "languageId": "plaintext"
    }
   },
   "outputs": [],
   "source": [
    "%%bash\n",
    "\n",
    "chmod +x setup-nim-operator.sh\n",
    "chmod +x setup-k8s.sh\n",
    "\n",
    "./setup-k8s.sh\n",
    "./setup-nim-operator.sh"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
